package com.example.abe.diandi.trends.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;

import com.example.abe.diandi.R;
import com.example.abe.diandi.trends.model.TrendModel;

import example.abe.com.framework.recycleview.base.ViewHolder;

import static com.example.abe.diandi.trends.model.TrendModel.TYPE_TEXT;

/**
 * Created by abe on 16/10/16.
 */
public class TextTrendsDelegate extends BaseTrendsDelegate {

    public TextTrendsDelegate(OnClickListener listener){
        super();
        setOnClickListener(listener);
    }

    @Override
    public boolean isForViewType(TrendModel item, int position){
        if (item.getType() == TYPE_TEXT){
            return true;
        }
        return false;
    }

    @Override
    protected void setInnerContent(Context context, FrameLayout contentView){
        View view = LayoutInflater.from(context).inflate(R.layout.item_content_trends_text, contentView, false);
        contentView.addView(view);
    }

    @Override
    protected void bindDetailViewHolder(ViewHolder holder, TrendModel t, int position){
        holder.setText(R.id.item_content_trends_tv, t.getContent());
    }
}
